<template>
  <div class="box" id="attachment">
    <attachment :code="code" :fujianObjList="fujianObjList"></attachment>
  </div>
</template>

<script>
import { attachmentList } from "@/api/common";
import attachment from "@/components/attachmentForThree";
export default {
  components: {
    attachment
  },
  data() {
    return {
      fujianObjList:[],
      code:'PROPHASE_SURVEY',
    };
  },
  mounted() {
    this.getFujian();
  },
  methods: {
    //获取附件列表
    getFujian() {
      const loading = this.$loading({
          lock: true,
          text: "Loading",
          spinner: "el-icon-loading",
          background: "rgba(0, 0, 0, 0.7)"
      });
      var data = {
        projectId: localStorage.getItem("projectId"),
        key:this.code
      };
      attachmentList(data).then(res => {
        console.log(res,"resssssssss")
        loading.close()
        if(res.data){
          var arr = []
          if(res.data.attachment){
            arr.push({title:'附件',list:res.data.attachment})
          }
          if(res.data.design){
            arr.push({title:'单体设计图',list:res.data.design})
          }
          if(res.data.drawing){
            arr.push({title:'图件',list:res.data.drawing})
          }
          this.fujianObjList = arr
        }
      }).catch(err =>{
        loading.close()
      });
    },
  }
};
</script>

<style lang="scss">

</style>
